home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Tech Arsenal 1
/
Tech Arsenal (Arsenal Computer).ISO
/
tek-01
/
dberror.c
< prev
next >
Wrap
Text File
|
1992-09-01
|
19KB
|
587 lines
//============================================================================
//
// DBERROR.C - Error parsing & display for TFile
//
//============================================================================
//
// Call via: DB_Error();
//
// Example: if(TfdCreate("MAIL",10,MailFields)==TF_ERROR) DB_Error();
//
// Returns: Nothing
//
//============================================================================
//
// Notes and such:
// --------------
// This code is released for the public domain and can be used in any way
// desired - obviously, don't try to sell this code for profit (nobody would
// be stupid enough to pay $$ for something this simple anyway)
//
// Note that TCXL and TFILE are Copyright Innovative Data Concepts
// any trademarks on TCXL and TFILE also belong to Innovative Data Concepts
//
// Hopefully the time spent entering all the error messages will benefit
// someone in addition to myself - I won't go into detail on using these
// as if you're using TFile and/or TCXL along with a C compiler, you should
// know enough to make proper use of these routines. These have been
// tested (successfully) using Turbo C++ 1.01 and Borland C++ 2.0
//
// ** You will need to use the appropriate header files for this
// I am using TCXL coding notations, so:
//
// In a nutshell: VOID = void
// CTYP = pascal (pascal calling convention
// compiler dependent)
// ChrP = char *
//
//============================================================================
//
// Have fun, and if you want to thank me, call my BBS at 519-357-1943
//
//============================================================================
VOID CTYP DBErr(ChrP message);
VOID DB_Error(NOARG) {
switch(TfErr) {
case 100:
DBErr("Invalid parameters to TfdCreate");
break;
case 200:
DBErr(".DBF File not open in TfdDelete");
break;
case 201:
DBErr("Invalid record number in TfdDelete");
break;
case 300:
DBErr("Not enough memory for dictionary in TfDicInit");
break;
case 301:
DBErr("Inalid dictionary n TfDicAdd");
break;
case 302:
DBErr("Invalid data field in TfDicAdd");
break;
case 303:
DBErr("Not enough memory for entry in TfDicAdd");
break;
case 304:
DBErr("Invalid dictionary in TfDicDel");
break;
case 305:
DBErr("Invalid data field in TfDicDel");
break;
case 306:
DBErr("Invalid dictionary in TfDicFnd");
break;
case 307:
DBErr("Invalid data field in TfDicFnd");
break;
case 308:
DBErr("Invalid dictionary in TfDicClose");
break;
case 400:
DBErr(".DBF file not open in TfFldVal");
break;
case 401:
DBErr(".DBF file not open in TfFldTyp");
break;
case 402:
DBErr(".DBF file not open in TfFldLen");
break;
case 403:
DBErr(".DBF file not open in TfFldDec");
break;
case 404:
DBErr(".DBF file not open in TfFldOfs");
break;
case 498:
DBErr(".DBF file not open in TfFldNam");
break;
case 499:
DBErr("Invalid position in TfFldNam");
break;
case 500:
DBErr(".DBF file not open in TfdInsert");
break;
case 501:
DBErr("Invalid record number in TfdInsert");
break;
case 502:
DBErr("TfdNewRec error in TfdInsert");
break;
case 503:
DBErr("Data file corrupt in TfdInsert");
break;
case 504:
DBErr("Low level read error in TfdInsert");
break;
case 505:
DBErr("Low level write error in TfdInsert");
break;
case 506:
DBErr("TfdWrite error in TfdInsert");
break;
case 507:
DBErr(".DBF file not open in TfdRemove");
break;
case 508:
DBErr("Invalid record number in TfdRemove");
break;
case 509:
DBErr("Low level read error in TfdRemove");
break;
case 510:
DBErr("Low level write error in TfdRemove");
break;
case 600:
DBErr(".DBF file not open in TfdDstruc");
break;
case 601:
DBErr(".DBF file not open in Tfdsize");
break;
case 602:
DBErr(".DBF file not open in TfdFlush");
break;
case 603:
DBErr("TfdClose error in TfdFlush");
break;
case 604:
DBErr("TfdOpen error in TfdFlush");
break;
case 605:
DBErr(".DBF file not open in TfdBuf");
break;
case 606:
DBErr(".DBF file not open in TfdFlds");
break;
case 607:
DBErr(".DBF file not open in TfdVersion");
break;
case 700:
DBErr("Too many files open in TfdOpen");
break;
case 701:
DBErr("Low level open error in TfdOpen");
break;
case 702:
DBErr("Low level read error in TfdOpen");
break;
case 703:
DBErr("Invalid dBase III file in TfdOpen");
break;
case 704:
DBErr("TfmOpen error in TfdOpen");
break;
case 705:
DBErr("Not enough memory for record buffer in TfdOpen");
break;
case 706:
DBErr("Not enough memory for field descriptions in TfdOpen");
break;
case 707:
DBErr("TfDicInit error in TfdOpen");
break;
case 708:
case 709:
DBErr("Low level read error in TfdOpen");
break;
case 710:
DBErr("Tfdread error in TfdOpen");
break;
case 711:
DBErr(".DBF file not open in Tfdclose");
break;
case 712:
DBErr("Low level read error in Tfdclose");
break;
case 713:
DBErr("Low level write error in Tfdclose");
break;
case 714:
DBErr("TfmClose error in Tfdclose");
break;
case 715:
DBErr("Low level close error in Tfdclose");
break;
case 800:
DBErr(".DBF file not open in TfdRead");
break;
case 801:
DBErr("Invalid record number in TfdRead");
break;
case 802:
DBErr("Low level read error in TfdRead");
break;
case 803:
DBErr(".DBF file not open in TfdWrite");
break;
case 804:
DBErr("Invalid record number in TfdWrite");
break;
case 805:
DBErr("Low level write error in TfdWrite");
break;
case 806:
DBErr(".DBF file not open in TfdNewRec");
break;
case 807:
DBErr(".DBF file not open in TfdRecall");
break;
case 808:
DBErr("Invalid record number in TfdRecall");
break;
case 809:
DBErr("Low level read error in TfdRecall");
break;
case 810:
DBErr("Record not delete error in TfdRecall");
break;
case 811:
DBErr("Low level write error in TfdRecall");
break;
case 812:
DBErr("Low level read error in TfdRecall");
break;
case 900:
DBErr("Unable to create file in TflCreate");
break;
case 1000:
case 1002:
DBErr("Unable to lock record in TfdRecLock");
break;
case 1001:
DBErr("Low level seek error in TfdRecLock");
break;
case 1003:
case 1005:
DBErr("Unable to unlock record in TfdRecUnlock");
break;
case 1004:
DBErr("Low level seek error in TfdRecUnlock");
break;
case 1006:
case 1008:
DBErr("Unable to lock file in TfdFilLock");
break;
case 1007:
DBErr("Low level seek error in TfdFilLock");
break;
case 1009:
case 1011:
DBErr("Unable to unlock file in TfdFilUnlock");
break;
case 1010:
DBErr("Low level seek error in TfdFilUnlock");
break;
case 1200:
DBErr("Unable to open file in TflOpen");
break;
case 1201:
DBErr("Unable to close file in TflOpen");
break;
case 1300:
DBErr("Low level seek error in TflRead");
break;
case 1301:
DBErr("Unable to read file in TflRead");
break;
case 1302:
DBErr("Low level seek error in TflWrite");
break;
case 1303:
DBErr("Unable to write file in TflWrite");
break;
case 1304:
DBErr("Unable to seek file in TflSeek");
break;
case 1400:
DBErr("Low level create error in TfmCreate");
break;
case 1401:
DBErr("Low level close error in TfmCreate");
break;
case 1402:
DBErr("Low level open error in TfmCreate");
break;
case 1403:
case 1404:
DBErr("Low level write error in TfmCreate");
break;
case 1405:
DBErr("Low level clsoe error in TfmCreate");
break;
case 1500:
DBErr(".DBF file not open in TfdMemoEdit");
break;
case 1501:
DBErr("Not enough memory for memo buffer in TfmEdit");
break;
case 1502:
DBErr("TfmRead error in TfmEdit");
break;
case 1503:
DBErr("Low level create error in TfmEdit");
break;
case 1504:
DBErr("Low level write error in TfmEdit");
break;
case 1505:
DBErr("Low level close error in TfmEdit");
break;
case 1506:
DBErr("system() error in TfmEdit");
break;
case 1507:
DBErr("Not enough memory for memo buffer in TfmEdit");
break;
case 1508:
DBErr("Low level open error in TfmEdit");
break;
case 1509:
DBErr("Low level read error in TfmEdit");
break;
case 1510:
DBErr("Low level close error in TfmEdit");
break;
case 1511:
DBErr("TfmWrite error in TfmEdit");
break;
case 1600:
DBErr(".DBF file not open in TfmFlush");
break;
case 1601:
DBErr("TfdClose error in TfmFlush");
break;
case 1602:
DBErr("TfdOpen error in TfmFlush");
break;
case 1603:
DBErr("Not enough memory for work buffer in TfmPack");
break;
case 1604:
DBErr("TfmCreate error in TfmPack");
break;
case 1605:
DBErr("TfmOpen error in TfmPack");
break;
case 1606:
DBErr("Invalid field type in TfmPack");
break;
case 1607:
DBErr("TfmClose error in TfmPack");
break;
case 1608:
DBErr("TfdClose error in TfmPack");
break;
case 1609:
DBErr("TfdOpen error in TfmPack");
break;
case 1700:
DBErr("Too many files open in TfmOpen");
break;
case 1701:
DBErr("Low level open error in TfmOpen");
break;
case 1702:
DBErr("Low level read error in TfmOpen");
break;
case 1703:
DBErr("Low level write error in TfmClose");
break;
case 1704:
DBErr("Low level close error in TfmClose");
break;
case 1800:
DBErr(".DBF file not open in TfdMemoRead");
break;
case 1801:
DBErr(".DBT file not open in TfmRead");
break;
case 1802:
DBErr("Not enough memory for memo buffer in TfmRead");
break;
case 1803:
DBErr("Low level read error in TfmRead");
break;
case 1804:
DBErr(".DBT file corrupt in TfmRead");
break;
case 1805:
DBErr(".DBF file not open in TfdMemoWrite");
break;
case 1806:
DBErr("Low level read error in TfmWrite");
break;
case 1807:
DBErr("Low level seek error in TfmWrite");
break;
case 1808:
DBErr(".DBT file corrupt in TfmWrite");
break;
case 1809:
DBErr("Not enough memory for gap buffer in TfmWrite");
break;
case 1810:
DBErr("Not enough memory for memo buffer in TfmWrite");
break;
case 1811:
DBErr("Low level write error in TfmWrite");
break;
case 1812:
DBErr("Low level write error in TfmWrite");
break;
case 1900:
DBErr("Invalid key length in TfiCreate");
break;
case 1901:
DBErr("Low level create error in TfiCreate");
break;
case 1902:
DBErr("Low level close error in TfiCreate");
break;
case 1903:
DBErr("Invalid key type in TfiCreate");
break;
case 1904:
DBErr("Key expression too long in TfiCreate");
break;
case 1905:
DBErr("Invalid key dup type in TfiCreate");
break;
case 1906:
DBErr("Low level open error in TfiCreate");
break;
case 1907:
DBErr("Low level write error in TfiCreate");
break;
case 1908:
DBErr("Low level write error in TfiCreate");
break;
case 1909:
DBErr("Low level close error in TfiCreate");
break;
case 2000:
DBErr(".NDX file not open in TfiDelKey");
break;
case 2001:
DBErr("No keys in .NDX file in _TfDelKey");
break;
case 2100:
DBErr(".NDX file not open in TfiGetKey");
break;
case 2101:
DBErr("No keys in .NDX file in _TfGetKey");
break;
case 2102:
DBErr("No exact key match in _TfGetKey");
break;
case 2103:
DBErr("Key not found in _TfGetKey");
break;
case 2200:
DBErr(".NDX file not open in TfiGetFst");
break;
case 2201:
DBErr("No keys in .NDX file in _TfGetFst");
break;
case 2202:
DBErr(".NDX file not open in TfiGetNxt");
break;
case 2300:
DBErr(".NDX file not open in TfiGetlst");
break;
case 2301:
DBErr("No keys in .NDX file in _TfGetLst");
break;
case 2302:
DBErr(".NDX file not open in TfiGetPrv");
break;
case 2400:
DBErr(".NDX file not open in TfiStruct");
break;
case 2500:
DBErr("Low level open error in TfiOpen");
break;
case 2502:
DBErr("Low level read error in TfiOpen");
break;
case 2503:
DBErr(".NDX file not open in TfiClose");
break;
case 2504:
DBErr("Low level flush error in TfiClose");
break;
case 2505:
DBErr("Low level read error in TfiClose");
break;
case 2506:
DBErr("Low level write error in TfiClose");
break;
case 2507:
DBErr("Low level close error in TfiClose");
break;
case 2508:
DBErr(".NDX file not open in TfiFlush");
break;
case 2509:
DBErr("Low level write error in TfiFlush");
break;
case 2600:
DBErr(".NDX file not open in TfiPutKey");
break;
case 2601:
DBErr("Invalid record number in TfiPutKey");
break;
case 2603:
case 2604:
DBErr("Low level write error in _TfPutKey");
break;
case 2602:
case 2605:
DBErr("Not enough memory for buffer in _TfPutKey");
break;
case 2606:
DBErr("Low level read error in TfPutLast");
break;
case 3000:
DBErr("Low level write error in _TfGetNode");
break;
case 3001:
DBErr("Not enough memory for buffer in _TfGetNode");
break;
case 3002:
DBErr("Low level read error in _TfGetNode");
break;
case 4000:
DBErr(".DBF file not open in TfdBuf2Ent");
break;
case 4001:
DBErr(".DBF file not open in TfdEnt2Buf");
break;
default:
DBErr("Unknown error in database sub-system");
}
}
VOID CTYP DBErr(ChrP message) {
//
// Custom error system handler
// Error_Msg(message); // Or use whatever you need to call your
// custom error handler
//
// TCXL basic error system handler
// Wperror(message);
//
// DOS error system handler
perror(message);
//
//
// - Remove comment lines from which-ever system you want to use
// - if using customized error system, change "Error_Msg(message)" line
// to what is required.
}